import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: '/login',
  },
  {
    path: "/home",
    redirect: '/homes',
  },
  {
    path: "/login",
    component: () => import('../views/login/login.vue')
  },
  {
    path: "/detail",
    component: () => import('../views/home/child/detail.vue')
  },
  {
    path: '/home',
    component: () => import('../views/home/index.vue'),
    children: [
      {
        path: '/homes',
        component: () => import('../views/home/child/home.vue')
      },
      {
        path: '/list',
        component: () => import('../views/home/child/list.vue')
      },
      {
        path: '/shop',
        component: () => import('../views/home/child/shop.vue')
      },
      {
        path: '/my',
        component: () => import('../views/home/child/my.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
